package com.yingdong.logic.service;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileLock;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Service;

import com.yingdong.annotation.AutoInvoke;

@Service
public class SystemService {
	static Log logger = LogFactory.getLog(SystemService.class);

	@AutoInvoke
	public static void init() throws IOException {

		Runtime.getRuntime().addShutdownHook(new Thread() {
			public void run() {
				logger.info("服务器开始关闭");
				OnlineService.save();
				logger.info("服务器关闭完成");
			}
		});
		logger.info("SystemService启动成功");
	}
}
